package cn.xs.core.entity;

import java.util.List;

import cn.xs.goods.entity.Good;

/**
 * 分页对象
 * @author xs
 *
 */
public class PageResult {
	
	private long totalCount;	//总记录数
	
	private int pageNo;	//当前页号
	
	private int totalPageCount;	//总页号
	
	private int pageSize;	//每页显示商品数
	
	private List<Good> items;
	
	public PageResult(long totalCount,int pageNo,int pageSize,List<Good> items){
		this.totalCount = totalCount;
		this.pageSize =pageSize;
		if(totalCount > 0){
			this.pageNo = pageNo;
			int tem = (int) (totalCount / pageSize);
			this.totalPageCount = totalCount%pageSize ==0?tem:tem+1;
		} else {
			this.pageNo = 0;
			this.totalPageCount = 0;
		}
		this.items = items;
	}
	
	public PageResult() {
		// TODO Auto-generated constructor stub
	}


	public long getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(long totalCount) {
		this.totalCount = totalCount;
	}
	public int getPageNo() {
		return pageNo;
	}
	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}
	public int getTotalPageCount() {
		return totalPageCount;
	}
	public void setTotalPageCount(int totalPageCount) {
		this.totalPageCount = totalPageCount;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public List<Good> getItems() {
		return items;
	}
	public void setItems(List<Good> items) {
		this.items = items;
	}
	
	
}
